home *** CD-ROM | disk | FTP | other *** search
/ HTBasic 9.3 / HTBasic 9.3.iso / 93win / data1.cab / CSUB / CSUB_Example / WINTEST.C < prev    next >
Encoding:
C/C++ Source or Header  |  2005-03-02  |  1.1 KB  |  33 lines

  1. /* wintest.c - A Windows test CSUB */
  2.  
  3. /* This routine prints a string and two numbers to a Windows message
  4.  * box and halts until the user clicks the mouse pointer in the OK
  5.  * part of the message box.
  6.  */
  7.  
  8. #include <windows.h>
  9. #include <stdio.h>              /* for sprintf() */
  10. #include "csubw.h"
  11.  
  12. int wintest(
  13.   int     npar,                 /* no. arguments */
  14.   strptr  msg,                  /* string part of message */
  15.   dimptr  msgdim,
  16.   realptr rval,                 /* real value */
  17.   intptr  ival)                 /* integer value */
  18. {
  19.   char buf[72];
  20.   char tmp[48];
  21.   int len;
  22.  
  23.   len = (int)msg->clen;                 /* length of input string */
  24.   if (len > 24)                         /* max. 24 */
  25.     len = 24;
  26.   memcpy(buf, msg->str, len);           /* move to buffer */
  27.   buf[len] = '\0';                      /* NUL-terminate */
  28.   sprintf(tmp, " Real value: %6.2f, Integer value: %4d\n", *rval, (int)*ival);
  29.   strcat(buf, tmp);                     /* add numeric values */
  30.   MessageBox(NULL, buf, "TEST CSUB", MB_ICONEXCLAMATION|MB_OK|MB_SYSTEMMODAL );   /* output */
  31.   return (0);
  32. }
  33.